int leftt[10000];
int rightt[10000];
class Solution {
public:
    int pivotIndex(vector<int>& nums) {
        int size = nums.size();
        rightt[size-1] = 0;
        for(int i = size-2;i>=0;i--){
            rightt[i] = rightt[i+1] + nums[i+1];
        }
        if(rightt[0] == 0) return 0;
        leftt[0] = 0;
        for(int i = 1;i<size;i++){
            leftt[i] = leftt[i-1]+nums[i-1];
            if(leftt[i] == rightt[i]){
                return i;
            }
        }
        return -1;
    }
};